#ifndef CC_YMODEM_SLAVE_H
#define CC_YMODEM_SLAVE_H

#include "YModemPublic.h"

#define CFG_YMODEM_SLAVE	

#define CFG_YMS_WAIT_SEC		60 	// 单位 : 秒

typedef struct CC_YModem_Slave_StateMachine tYM_Slave;

typedef struct YMS_Callback_API_Set{
	int (*pProcBeginPkg)(tYM_Slave* ctx, uint16_t len, uint8_t *buf);	
    int (*pProcDataPkg)(tYM_Slave* ctx, uint16_t len, uint8_t *buf);	
    int (*pProcEndPkg)(tYM_Slave* ctx, uint16_t len, uint8_t *buf);	
	int (*pExit)(tYM_Slave* ctx, uint16_t len, uint8_t *buf);	
}tYMS_CallBackAPI;

//
extern void YM_Slave_Show(tYM_Slave* pObj);
extern tYM_Slave* YM_Slave_SCreate(uint32_t BufSz);
extern int YM_Slave_BindCallback(tYM_Slave* pObj,const tYMS_CallBackAPI* pAPI); // App

extern int YM_Slave_BindSend(tYM_Slave* pObj,int (*pFunc)(uint16_t,uint8_t*));  // Tx
extern int SM_YModem(tYM_Slave *pObj,uint16_t Len ,uint8_t *pPkg);				// Rx
//
extern int YM_Slave_Set_RemainNum(tYM_Slave* pObj,uint32_t FileByteSz); // : 在 pProcBeginPkg 中使用
extern int YM_Slave_StateCtrl(tYM_Slave *pObj,uint8_t OnOff); 			// 0==off 1==on 
// extern int YM_Slave_Set_WaitSec(tYM_Slave* pObj,uint32_t WaitSec); 	// Fixed 等待1分钟
//


#endif


